<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <head>
    <meta charset="UTF-8">
    <title>首页</title>
    <style type="text/css">
        table {border-collapse: collapse; font-size: 14px; width: 80%; margin: auto}
        table, th, td {border: 1px solid darkslategray;padding: 10px}
    </style>

</head>
<body>
<div style="text-align: center">
    <span style="color: darkslategray; font-size: 30px">欢迎光临！1111333</span>
    <hr/>
    <table class="list">
        <tr>
            <th>序号</th>
            <th>id</th>
            <th>姓名</th>
            <th>用户名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>生日</th>
            <th>备注</th>
            <th>操作</th>
        </tr>
        <!--user:当前循环对象 status:序号  th:object="${user}：如果有这个，那么下面那些*开头的变量都会先加上user  -->
        <tr th:each="user, status : ${users}" th:object="${user}" th:bgcolor="${status.even}? 'gray'">
            <td th:text="${status.count}">1</td>
            <td th:text="${user.id}">1</td>
            <td th:text="*{name}">张三</td>           <!--配合上面的th:object  相当于${user.name} 这种方式可以简化格式-->
            <td th:text="*{userName}">zhangsan</td>
            <td th:text="${user.age}">20</td>
            <td th:text="${user.sex} == 1 ? '男': '女'">男</td>
            <td th:text="${#dates.format(user.birthday, 'yyyy-MM-dd')}">1980-02-30</td>
            <td th:text="${user.note}">1</td>
            <td>
                <!--url表达式-->
                <a th:href="@{/delete(id=${user.id}, userName=*{userName})}">删除</a>
                <!--文本替换方式-->
                <a th:href="|/update/${user.id}|">修改</a>
                <!--字符串拼接方式-->
                <a th:href="'/approve/' + ${user.id}">审核</a>
            </td>
        </tr>

    </table>
</div>


<h6 th:text="${users.size()}">静态内容</h6>
<h5>内联文本</h5>
<div>
    <h6 th:inline="text">[[${text}]]</h6>
    <h6 th:inline="none">[[${text}]]</h6>
    <h6>[[${text}]]</h6>
</div>

<h6 th:text="${#dates.createNow()}">获取当前日期</h6>
<td th:text="${#dates.format(#dates.createNow(), 'yyyy-MM-dd')}">1980-02-30</td>


<h5>thymeleaf布局</h5>
<div th:insert="footer :: copy('开课吧1')"></div>
<div th:replace="footer :: copy('开课吧2')"></div>
<div th:include="footer :: copy('kkk')"></div>

</body>
</html>